<?php
if (!defined('DP_BASE_DIR')) {
	echo 'You should not call this function directly!';
}
else if ($AppUI->user_id != 1) {
	echo "You don't have permission to do this action";
}
else {
	$day = $_GET['day'];
	$desc = $_GET['desc'];
	if ($desc == '')
		$sql = "DELETE FROM holidays WHERE hdate='$day'";
	else
		$sql = $_GET['set'] == '1' ?
		"INSERT INTO holidays (hdate, description) VALUES('$day', '$desc')" :
		"UPDATE holidays SET description='$desc' WHERE hdate='$day'";

	echo !db_exec( $sql ) ? 'Error' : 'OK';
}
?>
